'Populates the sponsor questionnaire with answers specified in the sponsor selection page
Option Strict Off
imports System
imports PHSRAG.Insight21.Humans
imports PHSRAG.Insight21.BusinessObjects
imports FormsManagement = PHSRAG.Insight21.FormsManagement
imports System.Collections

module Script
    sub Main()
                dim sponsorTypeAnswer as new PHSRAG.Insight21.FormsManagement.Answer(cachePolicy)
		select case sponsorType
			case Constants.SponsorTypes.GovernmentFoundation
				'sponsor type
				sponsorTypeAnswer.Name = "SponsorType"
				sponsorTypeAnswer.QuestionnaireAnswerId = questAnswer.Id
				sponsorTypeAnswer.Value = "GovFnd"
				questAnswer.Answers.Add(sponsorTypeAnswer)

				questAnswer.Save(connectionString)
			
			case Constants.SponsorTypes.CorporateSponsor
				'sponsor type
				sponsorTypeAnswer.Name = "SponsorType"
				sponsorTypeAnswer.QuestionnaireAnswerId = questAnswer.Id
				sponsorTypeAnswer.Value = "Corp"
				questAnswer.Answers.Add(sponsorTypeAnswer)

				questAnswer.Save(connectionString)
			
			case Constants.SponsorTypes.InstitutionalAward
				'sponsor type
				sponsorTypeAnswer.Name = "SponsorType"
				sponsorTypeAnswer.QuestionnaireAnswerId = questAnswer.Id
				sponsorTypeAnswer.Value = "Institutional"
				questAnswer.Answers.Add(sponsorTypeAnswer)

				questAnswer.Save(connectionString)

			case Constants.SponsorTypes.DepartmentFunds
				'sponsor type
				sponsorTypeAnswer.Name = "SponsorType"
				sponsorTypeAnswer.QuestionnaireAnswerId = questAnswer.Id
				sponsorTypeAnswer.Value = "DepartmentFund"
				questAnswer.Answers.Add(sponsorTypeAnswer)

				'questionnaire answer
				questAnswer.Name = "Department Funds"
				questAnswer.Save(connectionString)
			
			case Constants.SponsorTypes.None
				'primary sponsor
				dim primarySponsorAnswer as new PHSRAG.Insight21.FormsManagement.Answer(cachePolicy)
				primarySponsorAnswer.Name = "PrimarySponsor"
				primarySponsorAnswer.QuestionnaireAnswerId = questAnswer.Id
				primarySponsorAnswer.Value = "NA"
				questAnswer.Answers.Add(primarySponsorAnswer)

				'sponsor type
				sponsorTypeAnswer.Name = "SponsorType"
				sponsorTypeAnswer.QuestionnaireAnswerId = questAnswer.Id
				sponsorTypeAnswer.Value = "None"
				questAnswer.Answers.Add(sponsorTypeAnswer)

				'questionnaire answer
				questAnswer.Name = "None"
				questAnswer.Save(connectionString)

				'set sponsor id to the id for None
				theProtocol.SponsorId = 3418
				theProtocol.Save(connectionString)
		end select
         end sub
end module